<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8">
            <title>Nguyễn Trung Hiếu</title>
            <meta name="keywords" content="">
            <meta name="description" content="">
                    <link href="style.css" rel="stylesheet" type="text/css" media="screen">
                    <link type="text/css" rel="stylesheet" href="tsc_pagination.css">
    </head>
            <body>
                <?php require_once './header.php'; ?>
                <hr>
                <div id="page">
                    <?php
                    require_once './database/connection.php';
                    require_once './database/articles.php';
                    require_once './database/modify.php';
                    $obj = new articles();
                    $data = $obj->view_all();
                    $mod = new modify_data();
                    ?>
                    <div id="content">
                            <div class="post">
                                <form method="post" action="content_add.php">
                                    <p>title: </p> <input type="text" name="title"><br>
                                    <p>overview: </p> <input type="text" name="overview"><br>
                                    <p>body: </p> <input type="text" name="body"><br>
                                    <p>id_category: </p> <input type="text" name="id_category"><br>
                                    <input type="submit" name="them" value="Add">
                                    <table>
                                        <tr>
                                            <td>id</td>
                                            <td>title</td>
                                            <td>overview</td>
                                            <td>id_category</td>
                                        </tr>
                                        <?php
                                        foreach ($data as $dulieu){
                                            echo "<tr><td>".$dulieu['id']."</td><td>".$dulieu['title']."</td><td>".$dulieu['overview']."</td><td>".$dulieu['id_category']."</td>";
                                        }
                                        ?>
                                    </table>
                                </form>
                    <?php 
                        if(isset($_POST['them'])){
                            $mod->them_data();
                            echo 'Thêm Thành Công';
                            header("Location: index.php");
                        }
                    ?>
                            </div>
                    </div>
                </div>

